<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui-pull-refresh.css" />
    <link rel="stylesheet" type="text/css" href="../../css/swiper.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/aui-slide.css" />
    <style>
        body {
            margin: 0
        }
          #header_top {
            background: #f23030;
          }
          #header_top .aui-title {
            color: #fff;
          }
          .shop_info {
            background: #fff;
            width: 100%;
            padding: 1rem 0.75rem;
            position: absolute;;
            bottom: 0;
            height: 100px;
          }
          .shop_info h3 {
            color: #333;
            font-size: 1.2rem;
          }
          .shop_info h5 {
            color: #999;
            font-size: 0.6rem;
          }
    </style>
</head>

<body>

      <header class="aui-bar aui-bar-nav" id="header_top">
          <a class="aui-pull-left aui-btn" onclick="goback()">
              <span class="aui-iconfont aui-icon-left"></span>
          </a>
          <div class="aui-title">位置信息</div>
      </header>
      <div class="shop_info">
        <h3></h3>
        <h5></h5>
      </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/zepto.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/utils.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/aui-tab.js"></script>
<script type="text/javascript" src="../../script/aui-scroll.js"></script>
<script type="text/javascript" src="../../script/aui-pull-refresh.js"></script>
<script type="text/javascript" src="../../script/swiper.min.js"></script>
<script type="text/javascript" src="../../script/aui-slide.js"></script>
<script type="text/javascript">
function goback() {
  api.closeWin()
}
    apiready = function () {
      var header_top = $api.byId('header_top');
      var header_topPos = $api.offset(header_top);
      var address = api.pageParam.address
      var name = api.pageParam.name
      console.log(name + '---' + address)
      $('.shop_info h3').text(name)
      $('.shop_info h5').text(address)
      var bMap = api.require('bMap');
        bMap.getCoordsFromName({
            address: address
        }, function(ret, err) {
            if (ret.status) {
              bMap.open({
                rect: {
                  x: 0,
                  y: header_topPos.h,
                  w: api.frameWidth,
                  h: api.frameHeight - header_topPos.h - 100
                },
                center: {
                    lon: ret.lon,
                    lat: ret.lat
                },
                zoomLevel: 20,
                showUserLocation: true,
                fixedOn: api.frameName,
                fixed: true
              }, function(r) {
                if (r.status) {
                  bMap.addAnnotations({
                    annotations: [{
                        id: 1,
                        lon: ret.lon,
                        lat: ret.lat
                    }],
                    draggable: false
                    });
                }
              });
            } else {
              api.toast({ msg: err.code,duration: 2000,location:'middle' });
            }
        });

    }
</script>

</html>
